package kr.hkit.powerjava.chapter13; //LAB p.324

import java.awt.Dimension;
import java.awt.HeadlessException;
import java.awt.Toolkit;

import javax.swing.JFrame;
import javax.swing.JPanel;

public class MyWorkFrame extends JFrame {

	public MyWorkFrame() throws HeadlessException {
		init();
		
		HeaderPanel hp = new HeaderPanel();
		BtnPanel bp = new BtnPanel();
		JPanel p = new JPanel();
		
		p.add(hp);
		p.add(bp);
		
		add(p);
		pack();
		setVisible(true);
		
	}

	private void init() {
		
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setTitle("웰컴 자바 피자!");
		
		Toolkit tool = Toolkit.getDefaultToolkit();
		Dimension screenSize = tool.getScreenSize();
		Dimension frameSize = new Dimension(600, 150);

		// 스크린 정가운데에 창 출력
		int x = (int) (screenSize.getWidth() / 2 - frameSize.getWidth() / 2);
		int y = (int) (screenSize.getHeight() / 2 - frameSize.getHeight() / 2);
		setLocation(x, y);
		setSize(frameSize);
		
	}
}
